capture log close
clear all
set maxvar 30000
set more off
pause off
# delimit;

local crime "";
local output "";

/* 
Table B21
Cost-benefit analysis: victim cost of crime
*/


/* ****************************** */
/* **** GET THE IV ESTIMATES **** */
/* ****************************** */

use "`crime'/prworacombsib_bw264_crime_poly1allcov_iv_all.dta" ;
		
keep if variables=="any_crime2prbgt_1997_2017" | variables=="any_crime2prtft_1997_2017" | variables=="any_crime2vrobt_1997_2017" | variables=="any_crime2prfdt_1997_2017" | variables=="any_crime2vcpst_1997_2017" | variables=="any_crime2dgslt_1997_2017" | variables=="any_crime2dgpst_1997_2017" | variables=="any_crime2nisxt_1997_2017" | variables=="any_crime2niast_1997_2017" | variables=="any_crime2nitpt_1997_2017";		

gen order=1 if variables=="any_crime2prbgt_1997_2017";
replace order=2 if variables=="any_crime2prtft_1997_2017";
replace order=3 if variables=="any_crime2vrobt_1997_2017";
replace order=4 if variables=="any_crime2prfdt_1997_2017";
replace order=5 if variables=="any_crime2vcpst_1997_2017";
replace order=6 if variables=="any_crime2dgslt_1997_2017";
replace order=7 if variables=="any_crime2dgpst_1997_2017";
replace order=8 if variables=="any_crime2nisxt_1997_2017";
replace order=9 if variables=="any_crime2niast_1997_2017";
replace order=10 if variables=="any_crime2nitpt_1997_2017";

sort order;

replace variables="Burglary" if variables=="any_crime2prbgt_1997_2017";
replace variables="Theft" if variables=="any_crime2prtft_1997_2017";
replace variables="Robbery" if variables=="any_crime2vrobt_1997_2017";
replace variables="Fraud/forgery" if variables=="any_crime2prfdt_1997_2017";
replace variables="Prostitution" if variables=="any_crime2vcpst_1997_2017";
replace variables="Drug Dealing" if variables=="any_crime2dgslt_1997_2017";
replace variables="Drug Possession" if variables=="any_crime2dgpst_1997_2017";
replace variables="Sexual Assault" if variables=="any_crime2nisxt_1997_2017";
replace variables="Assault" if variables=="any_crime2niast_1997_2017";
replace variables="Trespass" if variables=="any_crime2nitpt_1997_2017";

keep variables n_age18unfav;

format n_age18unfav %3.2f;

rename n_age18unfav IV_estimate;


export excel using "`output'/tabB21.xls", firstrow(variables) ;

